/**
 * 
 */
package net.microlinktech.testing.ui.celleditor;

import org.jdesktop.swingx.JXTextField;

/**
 * @author Administrator
 * 
 */
public class HexTextField extends JXTextField {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2786015149857732303L;

	public HexTextField() {
		super();
		TextFieldDocument document = new TextFieldDocument();
		document.setCharLimit("[A-Fa-f0-9]");
		setDocument(document);
	}
	public HexTextField(String defaultString) {
		super();
		TextFieldDocument document = new TextFieldDocument();
		document.setCharLimit("[A-Fa-f0-9]");
		setDocument(document);
		setText(defaultString);
	}

	public HexTextField(int maxLength) {
		super(maxLength + "字节");
		TextFieldDocument document = new TextFieldDocument();
		document.setMaxLength(maxLength * 2);
		document.setCharLimit("[A-Fa-f0-9]");
		setDocument(document);

	}

	public HexTextField(int maxLength, String defaultString) {
		super(maxLength + "字节");
		TextFieldDocument document = new TextFieldDocument();
		document.setMaxLength(maxLength * 2);
		document.setCharLimit("[A-Fa-f0-9]");
		setDocument(document);
		setText(defaultString);
	}

}
